/*
 * utilities.hpp
 *
 *  Created on: 2 mars 2012
 *      Author: Jeff
 */

#ifndef UTILITIES_HPP_
#define UTILITIES_HPP_

// variables created by the build process when compiling the sketch
extern int __bss_end;
extern void *__brkval;

// function to return the amount of free RAM
int memoryFree()
{
int freeValue;
if((int)__brkval == 0)
freeValue = ((int)&freeValue) - ((int)&__bss_end);
else
freeValue = ((int)&freeValue) - ((int)__brkval);
return freeValue;
}

#endif /* UTILITIES_HPP_ */
